package com.noname.lib_base_java.net;

import java.util.List;

import io.reactivex.Flowable;
import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Streaming;
import retrofit2.http.Url;

/**
 * @author:Lmoumou
 * @date:2018/12/9 描述:
 **/
public interface BaseApi {

    /**
     * 文件下载
     *
     * @param start
     * @param url
     * @return
     */
    @Streaming
    @GET
    Observable<ResponseBody> download(@Header("RANGE") String start, @Url String url);

    /**
     * 单个文件上传
     *
     * @param description
     * @param file
     * @return
     */
    @Multipart
    @POST
    Observable<ResponseBody> upLoadFiel(@Url String url,
                                        @Part("path") RequestBody description,
                                        @Part MultipartBody.Part file);

    /**
     * 多个文件上传
     *
     * @param description
     * @param params
     * @return
     */
    @Multipart
    @POST
    Observable<ResponseBody> upLoadFiels(@Url String url,
                                         @Part("path") RequestBody description,
                                         @Part List<MultipartBody.Part> params);

    /**
     * 下载文件
     *
     * @param range
     * @param url
     * @return
     */
    @Streaming
    @GET
    Observable<ResponseBody> executeDownload(@Header("Range") String range, @Url() String url);

}
